﻿Imports System.Collections.Generic
Imports System.Linq
Imports System.Text

Imports Tohto.Base.ExceptionPolicy.Config

Namespace Interfaces
    Public MustInherit Class ExceptionHandlerBase
        Protected lstLogHandler As System.Collections.ArrayList
        Protected m_ExHandlerConfig As ExceptionConfig.ExceptionHandlerConfig

        Public Sub New()
            lstLogHandler = New System.Collections.ArrayList()
        End Sub

        Public Sub LoadLogHandler(ByVal config As ExceptionConfig.ExceptionHandlerConfig)
            m_ExHandlerConfig = config
            For Each logConfig As ExceptionConfig.LogHandlerConfig In config.LogConfigColletion
                Dim exLogHandler As Object = System.Activator.CreateInstance(Type.[GetType](logConfig.Type))
                lstLogHandler.Add(exLogHandler)
            Next
        End Sub

        Public ReadOnly Property ExHanlderConfig() As ExceptionConfig.ExceptionHandlerConfig
            Get
                Return m_ExHandlerConfig
            End Get
        End Property

        Public MustOverride Function ProcessExeception(ByVal ex As Exception, ByVal strUserId As String, ByVal strErrorCode As String) As String
    End Class
End Namespace
